package com.xwtec.iterator.v2;

/**
 * @Author: zt
 * @Date: 2021/3/4 21:34
 */
public class Main {
}

class LinkedList_ {
    Node head = null;
    Node tail = null;
    int size = 0;


    public void add(Object o) {

        Node n = new Node(o);
        if (head == null) {
            head = n;
            tail = n;

        } else {
            tail.next = n;
            tail = n;

        }
        size++;

    }

    public int getSize(){
        return size;
    }

    //一个内部节点类
    private class Node {
        //节点类自己的数据
        Object o;
        //指向的下一个节点
        Node next;

        public Node(Object o) {
            this.o = o;
        }

    }
}
